from pydantic import BaseModel, Field
from typing import List, Optional, Dict, Any
from datetime import datetime

class TemplateVariable(BaseModel):
    name: str
    description: Optional[str] = None
    default_value: Optional[str] = None
    required: bool = True

class PromptTemplateBase(BaseModel):
    name: str
    description: Optional[str] = None
    system_prompt: Optional[str] = None
    user_prompt: str
    variables: List[TemplateVariable] = []
    category: Optional[str] = None
    tags: List[str] = []

class PromptTemplateCreate(PromptTemplateBase):
    pass

class PromptTemplateUpdate(PromptTemplateBase):
    name: Optional[str] = None
    user_prompt: Optional[str] = None

class PromptTemplate(PromptTemplateBase):
    id: str
    created_at: str
    updated_at: str

class PromptTemplateUse(BaseModel):
    variable_values: Dict[str, Any]

class PromptTemplateResponse(PromptTemplateBase):
    id: str
    created_at: str
    updated_at: str

class PromptTemplateTest(BaseModel):
    model_id: str
    variables: Dict[str, str] = {}

class PromptTemplateTestResult(BaseModel):
    processed_template: Dict[str, str]
    ai_response: str 